package com.org.zp.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.org.zp.R;
import com.org.zp.entity.login.Resume;
import com.org.zp.entity.myzp.LayoutItem;

public class MyzhaopinResumeListAdapter extends BaseAdapter {
	private List<Resume> newsItems;
	private LayoutInflater mlinflater;

	public MyzhaopinResumeListAdapter(Context context, List<Resume> newsitems) {
		this.newsItems = newsitems;
		mlinflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return newsItems.size();
	}

	@Override
	public Object getItem(int position) {
		return newsItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View view, ViewGroup parent) {
		HrLetterHolder holder = null;
		if (null == view) {
			view = mlinflater.inflate(R.layout.myzp_resum_list_items, null);
			view.setBackgroundResource(R.drawable.list_bg_b);
			holder = new HrLetterHolder();
			holder.name = (TextView) view
					.findViewById(R.id.myzhaopin_resume_list_item_name);
			holder.audit = (TextView) view
					.findViewById(R.id.myzhaopin_resume_list_item_audit_cn);
			holder.click = (TextView) view
					.findViewById(R.id.myzhaopin_resume_list_item_click);
			view.setTag(holder);
		} else {
			holder = (HrLetterHolder) view.getTag();
		}

		holder.name.setText(newsItems.get(position).getResume_title());
		holder.audit.setText(newsItems.get(position).getResume_talent_cn());

		holder.click.setText("已有" + newsItems.get(position).getShow_count()
				+ "人查看");

		return view;
	}

	class HrLetterHolder {
		TextView name;//
		TextView audit;//
		TextView click;//

	}

	/**
	 * 添加数据列表项
	 * 
	 * @param newsitem
	 */
	public void addNewsItem(Resume newsitem) {
		newsItems.add(newsitem);
	}

}
